import time
from argparse import Action
from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("http://121.43.169.97:8848/pageA.html")

driver.maximize_window()

# 实例化并获取ActionChains类
action = ActionChains(driver)
# 定位用户名、在用户名上右击鼠标
# username = driver.find_element_by_css_selector("#userA")
# 输入用户名admin
username = driver.find_element_by_css_selector("#userA").send_keys("admin")
# 调用右键方法
action.double_click(username).perform()

# 鼠标移动到'注册按钮'，预期：按钮变色
button = driver.find_element_by_xpath("//p[5]/button")
action.move_to_element(button).perform()